package com.ruoyi.wechat.domain;

import com.ruoyi.wechat.common.ServiceException;
import org.apache.http.HttpStatus;
import org.springframework.util.ObjectUtils;

/**
 * <p>
 * 登录用户信息
 * </p>
 *
 * @author YinHeng
 * @since 2024/2/25
 */
public class SessionInfo {

    private AppUser appUser;

    private String sessionKey;

    public AppUser getAppUser() {
        if (ObjectUtils.isEmpty(appUser)){
            throw new ServiceException(HttpStatus.SC_UNAUTHORIZED,"登录已过期，请重新登录");
        }
        return appUser;
    }

    public void setAppUser(AppUser appUser) {
        this.appUser = appUser;
    }

    public String getSessionKey() {
        return sessionKey;
    }

    public void setSessionKey(String sessionKey) {
        this.sessionKey = sessionKey;
    }

}
